Page({
  data: {
    banners: [
      { id: 1, imageUrl: '/images/banner1.jpg' },
      { id: 2, imageUrl: '/images/banner2.jpg' },
      { id: 3, imageUrl: '/images/banner3.jpg' }
    ],
    news: [
      { id: 1, title: '如何照顾生病的宠物', url: '/pages/news/article1' },
      { id: 2, title: '最新宠物疫苗信息', url: '/pages/news/article2' },
      { id: 3, title: '夏季宠物护理小贴士', url: '/pages/news/article3' }
    ],
    userInfo: {}
  },
  onLoad: function() {
    const app = getApp();
    if (app.globalData.userInfo) {
      this.setData({
        userInfo: app.globalData.userInfo
      });
    } else {
      // 由于 getUserInfo 是网络请求，可能会在 Page.onLoad 之后才返回
      app.userInfoReadyCallback = res => {
        this.setData({
          userInfo: res.userInfo
        });
      };
    }
  },
  onLoad() {
    // 页面加载时执行的逻辑
  },
  navigateTo(event) {
    const { page } = event.currentTarget.dataset;
    wx.navigateTo({
      url: `../${page}/${page}`
    });
  },
  navigateToNews(event) {
    const { url } = event.currentTarget.dataset;
    wx.navigateTo({ url });
  }
  
})